package com.xs.controller;

import com.xs.entity.Person;
import jdk.nashorn.internal.objects.annotations.Getter;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

@Controller
public class IndexController {

    @RequestMapping("/wel")
    public String toIndex() {
        System.out.println("登入用户");
        return "/WEB-INF/wel.jsp";
    }

    @RequestMapping("/table")
    @ResponseBody
    public List<Person> table() {
        Person person = new Person(1, "person", "demo1");
        Person person1 = new Person(2, "person1", "demo1");
        Person person2 = new Person(3, "person2", "demo1");
        Person person3 = new Person(4, "person3", "demo1");
        Person person4 = new Person(5, "person4", "demo1");
        Person person5 = new Person(6, "test1", "demo1");
        Person person6 = new Person(7, "test1", "demo1");
        Person person7 = new Person(8, "test1", "demo1");
        Person person8 = new Person(9, "test1", "demo1");
        Person person9 = new Person(10, "test1", "demo1");
        Person person10 = new Person(11, "test1", "demo1");
        Person person11 = new Person(12, "test1", "demo1");
        Person person12 = new Person(13, "test1", "demo1");
        Person person13 = new Person(14, "test1", "demo1");

        List list = new ArrayList();
        list.add(person);
        list.add(person1);
        list.add(person2);
        list.add(person3);
        list.add(person4);
        list.add(person5);
        list.add(person6);
        list.add(person7);
        list.add(person8);
        list.add(person9);
        list.add(person10);
        list.add(person11);
        list.add(person12);
        list.add(person13);

        return list;
    }

}
